#include <func.h>

//lseek用于调整光标的位置
//也可用于做大文件
int main()
{
    int fd;
    fd=open("file",O_RDWR);
    ERROR_CHECK(fd,-1,"open");
    char buf[1024]={0};
    off_t offset=lseek(fd,11,SEEK_SET);
    ERROR_CHECK(offset,-1,"lseek");

    //输出的是指针偏移量
    printf("offset=%ld\n",offset);

    int ret=read(fd,buf,sizeof(buf));
    ERROR_CHECK(ret,-1,"read");
    puts(buf);//打印读取的内容
    ret=write(fd,"howareyou",9);
    ERROR_CHECK(ret,-1,"write");
    return 0;
}